<script lang='tsx' name='ThemeItem' setup>

const {name, selected = false} = defineProps<{
  name: string
  img: string
  selected: boolean
}>()
</script>

<template>
  <div class='theme-item-container'>
    <div :style="{backgroundImage: `url(${img})`}" class="theme-img">
      <img v-show="selected" alt="" class="theme-select" src="@/assets/img/icon/select.png">
    </div>
    <div class="theme-line"></div>
    <div class="theme-title" style="padding:14px 12px">{{ name }}</div>
  </div>
</template>

<style lang='scss' scoped>
.theme-item-container {
  flex: 1;
  max-width: 360px;
  border-radius: 8px;
  overflow: hidden;
  @include fold();

  .theme-img {
    position: relative;
    box-sizing: border-box;
    aspect-ratio: 36 / 23;
    background-color: #7b8290;
    border-radius: 8px;
    background-repeat: no-repeat;
    background-size: cover;

    .theme-select {
      position: absolute;
      width: 20px;
      height: 20px;
      bottom: 10px;
      right: 10px;
    }
  }


  .theme-line {
    height: 1px;
    background-color: transparent;
    margin: 0 auto;
    width: 96%;
    @include fold();
  }

  &:hover {
    background-color: var(--theme-item-hover-color);
    box-shadow: 0 2px 12px 2px rgba(0, 0, 0, 0.05);

    .theme-line {
      background-color: var(--theme-item-line-hover-color);
    }
  }
}
</style>
